<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script>
			//构造函数模式 作业

			//小明 今年18岁 性别男 有男朋友 男朋友说 说什么自己定
			function Person(name, age, sex, hasbf, bfsay, say) {
				this.name = name;
				this.age = age;
				this.sex = sex;
				this.hasbf = hasbf;
				this.bfsay = bfsay;
				this.say = say;
				console.log(this.name + "今年" + this.age + "岁," + "性别:" + this.sex + " " + this.hasbf + " " + this.bfsay + "说" + this.say)
			}
			var person = new Person("小明", 18, "男", "有男朋友", "男朋友", "我们分手吧，我喜欢女人了")
				//工厂模式

			//造一辆车 出厂 （合格证/建议零售价/说明书）
			function CreatCar(name, time, product, price, specification) {
				var Car = new Object();
				Car.name = name;
				Car.time = time;
				Car.product = product;
				Car.price = price;
				Car.specification = specification;
				Car.sayName = function() {
					console.log(this.name + "出厂时间：" + this.time + "合格证：" + this.product + "建议零售价：" + this.price + "说明：" + this.specification)
				}
				return Car;
			}

			var car = CreatCar("玛莎拉蒂", "2017.7.25", "合格", "910000", "百年辉煌，铸造意式典范")
			car.sayName()
		</script>
	</body>

</html>